$tab-control-width = $tab-height*0.5;
.tab-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  height: 100%;
}

.tab-content {
  flex: 1 0 auto;
  position: relative;
}
.tab-content-container {
  absolute(0);
  .tab-content-placeholder-monkey {
    content: '';
    absolute(0);
    codingMonkeyBackground();
    filter: grayscale(100%) brightness(500%) brightness(50%);
    -webkit-filter: grayscale(100%) brightness(500%) brightness(90%);
    background-size: 400px;
  }
}
.tab-content-item {
  width: 100%;
  height: 100%;
}

.tab-bar {
  noSelect();
  flex: 0 0 auto;
  display: flex;
  align-items: center;

  > ul {
    display: flex;
    height: 100%;
    align-items: flex-end;
    overflow-x: auto;
    &::-webkit-scrollbar {display: none;}
  }

  > .tab-show-list {
    width: $tab-height - 4px;
    position: relative;
    text-align: center;
    flex-shrink: 0;
    // https://www.w3.org/TR/css-flexbox-1/#auto-margins
    margin-left: auto;
    margin-bottom: 4px;
  }

  .tab-add-btn {
    $tab-add-btn-size = 14px;
    box-sizing: content-box;
    text-align: center;
    margin-left: 8px;
    flex-shrink: 0;
    width: $tab-add-btn-size;
    height: $tab-add-btn-size;
    cursor: pointer;
    color: $text-color-subtle;
    opacity: 0.5;
    &:hover {
      opacity: 1;
    }
    svg {
      width: $tab-add-btn-size;
      height: $tab-add-btn-size;
      fill: currentColor;
    }
  }
}

.tab-label-insert-pos {
  width: 2px;
  background-color: $text-color-info;
  height: 100%;
  position: relative;
  &:before {
    content: '';
    display: block;
    border-style: solid;
    border-color: transparent;
    border-width: 6px;
    border-bottom: none;
    border-top-color: $text-color-info;
    absolute(top 4px left -5px)
    margin-top: -4px;
  }
}

.tab-label {
  min-width: 92px;
  max-width: 200px;
  padding-left: 6px;
  flex-grow: 1;
  display: flex;
  align-items: center;
  position: relative;
  cursor: default;
  border-left: 2px solid transparent;

  .tab-label-insert-pos {
    absolute(top 0px left -2px bottom 0);
  }
  .fa {
    height: $tab-height;
    line-height: $tab-height;
  }

  .title {
    text-overflow: ellipsis;
    padding: 0 4px;
  }

  .control {
    min-width: $tab-control-width;
    width: $tab-control-width;
    height: $tab-control-width;
    cursor: pointer;
    margin-left: auto;
    margin-right: 2px;
    position: relative;
  }
}


.tab-label {
  // case default:
  i {
    absolute(0);
    line-height: $tab-control-width;
    text-align: center;
    font-style: normal;
  }

  .dot {
    height: $tab-control-width*0.5;
    width: $tab-control-width*0.5;
    margin-top: $tab-control-width*0.25;
    margin-left: $tab-control-width*0.25;
    border-radius: 100%;
    background-color: $text-color-info;
    display: none;
  }

  .close {
    display: none;
    font-size: 1.4em;
    opacity: 0.5;
  }

  &.active {
    border-left-color: $text-color-info;
  }

  // case hover-on-tab / tab-is-active:
  &.active, &:hover {
    .close {display: block;}
  }

  // case modified flag:
  &.modified {
    .dot {display: block;}
    .close {display: none;}
  }

  // case hover-on-tab-control
  .control:hover {
    .dot {display: none;}
    .close {
      display: block;
      opacity: 1;
    }
  }

}

.tab-content-item {
  display: none;
  &.active {
    display: block;
  }
}
